#include <stdio.h>


class step{
	int x;
	int y;
	int dis;
	step(int tx, int ty){
		x = tx;
		y = ty;
	}
};

int go(int &maze[5][5], step &steps[5][5], int x, int y){
	if()


}
int main()
{
	int maze[5][5];
	step steps[5][5];
	//input
	for(int i = 0;i < 5;i++){
		for(int j = 0;j < 5;j++){
			scanf("%d",&maze[i][j]);
			steps[i][j].x = -1;
			steps[i][j].y = -1;
			steps[i][j].dis = 10000;
		}
	}

	go(maze,steps,0,0);
	

	return 0;
}